import {Provider} from "./base";
import {ethers} from 'ethers';

export function transferETSC({privateKey, to, gasPrice, value}) {
    let wallet = new ethers.Wallet(privateKey, Provider.ETSC);
    let tx = {
        to: to,
        gasPrice: ethers.utils.bigNumberify((gasPrice * 10 ** 9).toString()),
        value: ethers.utils.parseEther(value),
        chainId: 1811
    };

    return wallet.sendTransaction(tx);
}

export function transferETH({privateKey, to, gasPrice, value}) {
    let wallet = new ethers.Wallet(privateKey, Provider.ETH);
    let tx = {
        to: to,
        gasPrice: ethers.utils.bigNumberify((gasPrice * 10 ** 9).toString()),
        value: ethers.utils.parseEther(value),
    };

    // console.log(privateKey, gasPrice, tx, ethers.utils.getNetwork('homestead').chainId);

    return wallet.sendTransaction(tx);
}